
int maxArea(vector<int>& height) {
    int n = height.size();
    int left = 0, right = n - 1;
    int fight = 0;
    while (left < right)
    {
        int width = right - left;
        int length = min(height[left], height[right]);
        int volume = width * length;
        fight = max(fight, volume);
        if (length == height[left])
            left++;
        else
            right--;
    }
    return fight;
}
int triangleNumber(vector<int>& nums) {
    sort(nums.begin(), nums.end());
    int sum = 0, n = nums.size();
    for (int end = n - 1; end >= 2; end--)
    {
        int left = 0, right = end - 1;
        while (left < right)
        {
            if (nums[left] + nums[right] > nums[end])
            {
                sum += right - left;
                right--;
            }
            else
                left++;
        }
    }
    return sum;
}